<?php
namespace Admin\Model;

class RoleModel extends CommonModel{
	protected $_fields = ["role_name"];
	protected $_validate = [
		["role_name","require","角色名称必填"],
		['role_name','','帐号名称已经存在！',0,'unique']
	];
	public function listData(){
		$pageSize = 20;
		$count = $this->count();
		$Page = new \Think\Page($count,$pageSize);
		$show = $Page->show();
		$list = $this->order("id")->limit($Page->firstRow.",".$pageSize)->select();
		return ["pageStr"=>$show,"list"=>$list];
	}
	public function dels($id){
		return $this->where("id=".$id)->delete();
	}
	public function update($data){
		//修改角色
		return $this->save($data);
	}
}